<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let promise = new Promise((resolve,reject)=>{
            if(true){
                resolve(1);
            }else{
                reject(2);
            }
        })
        promise.then((data)=>{
            console.log(data);
        })
        promise.catch((err)=>{
            console.log(err);
        })
        promise.finally(()=>{
            console.log("都会执行")
        })
    </script>
</body>
</html>